from django.conf.urls import url, include
from rest_framework_jwt.views import obtain_jwt_token

from areas.views import AreasInfoViewset
from users import views

urlpatterns = [
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.RegisterUsernameAPIView.as_view()),
    # GET /users/phones/(?P<mobile>1[345789]\d{9})/count/
    url(r'^phones/(?P<mobile>1[3-9]\d{9})/count/$',views.RegisterPhoneAPIView.as_view()),
    url(r'^$',views.RegisterCreateView.as_view()),
    # url(r'^$',views.RegisterOneView.as_view()),
    # url(r'^$',views.RegisterTwoView.as_view()),
    # token设置,

    url(r'^auths/',obtain_jwt_token),
    # GET/users/infos/(用户中心页面)
    # url(r'^infos/$',views.UserDetailView.as_view()),
    url(r'^infos/$',views.UserCenterAPIView.as_view()),
    # url(r'^emails/$',views.EmailView.as_view()),

    url(r'^emails/$', views.UpdateEmailAPIView.as_view()),
    # url(r'emails/$',views.EmailThreeView.as_view()),
# GET /users/emails/verification/
#     url(r'emails/verification/',views.VerificationEmailView.as_view()),
# VerializationEmailAPIView
    url(r'emails/verification/',views.VerializationEmailAPIView.as_view()),
#     增加地址
    url(r'^addresses/$',views.AddressView.as_view()),
    # url(r'^addresses/$',views.AddressTwoView.as_view()),
    url(r'^addresses/(?P<pk>\d+)/$',views.DeleteAddressAPIView.as_view()),
#     设置默认地址
    url(r'addresses/(?P<pk>\d+)/status/$',views.ChangeDefaultAddressAPIView.as_view()),
    # 设置标题
    url(r'addresses/(?P<pk>\d+)/title/$',views.ChangeTitleAPIView.as_view()),
#     新增浏览记录
    url(r'^browerhistories/$',views.AddUserBrowerhistoriesAPIView.as_view()),

]

